An easy answer is given by Torsten Marek in this link: Which Python memory profiler is recommended?, ... # estimate sizeof object without __sizeof__ def sizeof(o): if id(o) in seen: # do not double count the same object return 0 seen.add (o, default_size)